<?php

require_once 'init.php';
require_once cf\Config::path.'api/page.php';

$product = new cf\Product( cf\param::get('id') );
$smarty->assign('product', $product);

$smarty->assign('imageTexts',$product->imageTexts());

$path = array(array('name'=>$product->fullName()));

$related = new cf\RelatedProducts($product->id());
$smarty->assign('relatedProducts', $related->getList());

$inCategories = new cf\ProductGroups($product->id());
if (!$inCategories->is_empty()) {
	$category = cf\api\shop\getCategory($inCategories->at(0)->id(), '/catalog');
	$path = array_merge($category['branch'],$path);
	$smarty->assign('category', $category);
	showCatsInLeftMenu($category);
	getPromo($category);
}

$smarty->assign('video', cf\query2var('SELECT video FROM cf_products WHERE id=:id',array('id'=>$product->id())));

show(
	'product', 
	$product->fullName(), 
	$path,
	$product->tagTitle() ? $product->tagTitle() : $product->fullName(), 
	$product->tagMetaKeywords(), 
	$product->tagMetaDescr()
);

?>